<template>
    <div class="action">
        <h2 @click="handleClick(1)">首页</h2>
        <h2 @click="handleClick(0)">关于</h2>
    </div>
</template>
<script setup lang="ts">
    import { useRouter } from 'vue-router'
    // router === $router(vue2.0)
    const router = useRouter()

    const handleClick = (num: number) => {
        if (num) {
            router.push({ name: 'one' })
        } else router.push({ name: 'two' })
    }
</script>
<style>
    .action {
        display: flex;
    }
    h2 {
        padding: 0px 10px;
        cursor: pointer;
    }
    h2:hover {
        color: red;
    }
</style>
